package ye.guo.huang.java9;

import java.util.AbstractMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * @Author: HUANG GY.
 * @Date: 2021/11/10 11:23
 * @Description: ye.guo.huang.java9
 */
public class Test04Stream {

    public static void main(String[] args) {
        //takeWhile 依次访问收集，直到false退出
        System.out.println("=====1=========");
        Stream.of("a","b","c","","e","f").takeWhile(s->!s.isEmpty())
                .forEach(System.out::print);
        System.out.println("=====2=========");
        //从false开始收集
        long count = Stream.of("a", "b", "c", "", "e", "f").dropWhile(s -> !s.isEmpty()).count();
        System.out.println("count="+count);

        System.out.println("=====3=========");
        IntStream.iterate(3, x -> x < 10, x -> x+ 3).forEach(System.out::println);
    }

}